package 线程池;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class MyPoolFixed {
    //线程池相关的 类
    //1.ExecutorService //线程池的接口
    //2.ThreadPoolExecutor //线程池的实现类

    //类Executors的方法
    //1.newFixedThreadPool(int nThreads)  //固定大小的线程池
    //2.newCachedThreadPool()  //创建一个没有固定大小的线程池
    //3.newSingleThreadExecutor()  //创建一个单线程的线程池

    public static void main(String[] args) throws InterruptedException {
        ExecutorService pool1 = Executors.newFixedThreadPool(3);

        pool1.submit(new MyRunable());
        pool1.submit(new MyRunable());
        pool1.submit(new MyRunable());
        pool1.submit(new MyRunable());
        pool1.submit(new MyRunable());
        pool1.submit(new MyRunable());

    }
}
